﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;

namespace Qr.Servce {
    // 开发者凭据
    public class DeveloperCredential {

        public string AppId { get; set; }
        public string AppSecret { get; set; }

        public static DeveloperCredential GetItemFromConfig() {
            string appId = ConfigurationManager.AppSettings["AppId"];
            string appSecret = ConfigurationManager.AppSettings["AppSecret"];
            DeveloperCredential item;

            if (!String.IsNullOrEmpty(appId) && !String.IsNullOrEmpty(appSecret)) {
                item = new DeveloperCredential { AppId = appId, AppSecret = appSecret };
            }
            else {
                Log.Info("DeveloperCredential.GetItemFromConfig, 未设置AppId或者AppSecret");
                throw new Exception("未设置AppId或者AppSecret");
            }

            return item;
        }
    }
}